package mroute

import (
	"github.com/gin-gonic/gin"
	"mygo/myws"
	"mygo/mroute/utils"
	"strconv"
	"time"
)

/* =================================================================================
   Ws接口
*/
func MyWsApi(cont *gin.Context) {
	ConnectId := cont.DefaultQuery("userid", strconv.FormatInt(time.Now().UnixNano(), 10))
	ws, err := myws.UpGrader.Upgrade(cont.Writer, cont.Request, nil)
   if err != nil {
      return
   }
   go myws.NewWsApi(ws, ConnectId, utils.GetClientIP(cont))
}

